import request from "../../request";

const api = {
    getLiabilities: '/admin/liabilities/all',
    update: '/admin/liabilities/update',
    save: '/admin/liabilities/save',
    deleteId: '/admin/liabilities/delete/id=',
    delbatch: '/admin/liabilities/del/batch',
    liabilitiesById: '/admin/liabilities/get-liabilities/id=',
    liabilitiesPage: '/admin/liabilities/page'
}


/**
 * 添加
 * @param data
 * @returns {AxiosPromise}
 */
export function saveLiabilitiesData(param){
    return request({
        url: api.save,
        method: 'POST',
        data: param
    })
}


/**
 * 根据id进行删除
 * @returns {AxiosPromise}
 */
export function delLiabilitiesByid(id){
  return request({
      url: api.deleteId + id,
      method: 'GET'
  })
}

/**
 * 批量删除
 * @param ids
 * @returns {AxiosPromise}
 */
export function delLiabilitiesBatch(ids){
  return request({
      url: api.delbatch,
      method: 'POST',
      data: ids
  })
}

/**
 * 修改
 * @param data
 * @returns {AxiosPromise}
 */
export function updateLiabilities(param){
  return request({
      url: api.update,
      method: 'POST',
      data: param
  })
}

/**
 * 查询全部数据
 * @returns {AxiosPromise}
 */
export function getLiabilities(){
  return request({
      url: api.getLiabilities,
      method: 'GET',
  })
}

/**
 * 根据id进行查询
 * @returns {AxiosPromise}
 */
export function getLiabilitiesByid(id){
  return request({
      url: api.liabilitiesById + id,
      method: 'GET'
  })
}

/**
 * 分页查询
 * @param data
 * @returns {AxiosPromise}
 */
export function getLiabilitiesPage(param){
  return request({
      url: api.liabilitiesPage,
      method: 'GET',
      params: param
  })
}